/******************************************************************
*                                                                 *
* The ChooseFontDialog class controls all the UI associated with  *
* the dialog and uses the support routines in FontEnumeration.cpp *
* to enumerate fonts and get various information about each one.  *
*                                                                 *
******************************************************************/

class ChooseFontDialog
{
public:
    ChooseFontDialog();

    HRESULT GetTextFormat(IDWriteTextFormat** textFormat, HWND hparent);
    HRESULT GetTextFormat(IDWriteTextFormat* textFormatIn, IDWriteTextFormat** textFormatOut, HWND hparent);

    ~ChooseFontDialog();

private:
    HWND                    m_dialog;
    WCHAR                   m_localeName[LOCALE_NAME_MAX_LENGTH];
    IDWriteFontCollection*  m_fontCollection;
    IDWriteTextFormat*      m_currentTextFormat;
    
    HRESULT OnFontFamilySelect();
    HRESULT OnFontFaceSelect();
    HRESULT OnFontSizeSelect();

    HRESULT OnFontFamilyNameEdit(HWND hwndFontFamilies);
    HRESULT OnFontFaceNameEdit(HWND hwndFontFaces);
    HRESULT OnFontSizeNameEdit(HWND hwndFontSizes);

    HRESULT DrawSampleText(HDC sampleDC);

    static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

    BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
    void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
    void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT* lpDrawItem);
};